﻿using UnityEngine;
using UnityEngine.Serialization;
using Object = UnityEngine.Object;

namespace Neatly.Hierarchy
{
    public class NodeHierarchy : MonoBehaviour
    {
        //原始资源名称
        private string m_AssetName;
        //是否Ltr
        public bool isLTR;

        [System.Serializable]
        public struct ItemInfo
        {
            public string name;
            public Object item;
            public ItemInfo(Object _item) { name = _item.name; item = _item; }
        }

        // 控件
        public ItemInfo[] widgets;
        // 外部引用
        public ItemInfo[] externals;
        //不需要RTL的组件
        public LTRExport[] ltrList;
        //强制翻转的组件
        public ReversalExport[] reversalList;

        public void SetAssetName(string assetName)
        {
            m_AssetName = assetName;
        }

        private void OnDestroy()
        {
            if (NeatlyFrame.Instance.DestroyAction!=null)
            {
                if (!string.IsNullOrEmpty(m_AssetName))
                {
                    NeatlyFrame.Instance.DestroyAction(m_AssetName);
                }
            }
        }
    }
}